﻿using Hotel_Project.Bean;
using Hotel_Project.BIZ;
using Hotel_Project.Tools.MySqlData_Helps;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Hotel_Project.HotelForm
{
    public partial class Night_ShenForm : Form
    {

        static List<Night_ShenDomain> list = new List<Night_ShenDomain>();
        static Night_ShenStrip night_ = new Night_ShenStrip();
        public Night_ShenForm()
        {
            Fulsh();
            InitializeComponent();
        }

        private void add_Click_1(object sender, EventArgs e)
        {


            Night_ShenDomain night_Shen = new Night_ShenDomain();


            //night_Shen.Staff_id = 0;

            list.Add(new Night_ShenDomain(
            night_Shen.Staff_id = Convert.ToInt32(Id.Text),
            night_Shen.Staff_identity = Convert.ToInt32(identity.Text),
            night_Shen.Staff_name = Names.Text,
            night_Shen.Staff_age = Convert.ToInt32(age.Text),
            night_Shen.Staff_sex = sex.Text,
            night_Shen.Staff_phone = Convert.ToInt32(phone.Text),
            night_Shen.Staff_birth = born.Text,
            night_Shen.Time_on = on.Text,
            night_Shen.End_time = no.Text
            ));
            MessageBox.Show("str");
            night_.Add(list);
            Fulsh();

        }
        public async void Fulsh()
        {
            MySqlDataTable da = new MySqlDataTable();
            DataTable dataTable = await da.GetDataTable(MySqlString.MYSQL_CONNAND, MySqlString.MYSQL_SELECT_staff);
            dataTable.Columns[0].ColumnName = "员工编号";
            dataTable.Columns[1].ColumnName = "身份证";
            dataTable.Columns[2].ColumnName = "员工姓名";
            dataTable.Columns[3].ColumnName = "员工年龄";
            dataTable.Columns[4].ColumnName = "员工性别";
            dataTable.Columns[5].ColumnName = "员工电话";
            dataTable.Columns[6].ColumnName = "出生日期";
            dataTable.Columns[7].ColumnName = "开始时间";
            dataTable.Columns[8].ColumnName = "结束时间";
            dataGridView1.DataSource = dataTable;
        }
        private void delete_Click(object sender, EventArgs e)
        {
            if (Id.Text != null && Id.Text != "")
            {
                list.Add(new Night_ShenDomain(Convert.ToInt32(Id.Text)));
                night_.Detele(list);
                Fulsh();
            }
        }
    }
}